import shutil,os
import datetime as dt

def copy_file(source_path, destination_path):
    """
    复制文件从源路径到目标路径
    :param source_path: 源文件路径
    :param destination_path: 目标文件路径
    :return: None
    """
    try:
        t1=dt.datetime.now()
        len=os.path.getsize(source_path)/(1024*1024)
        shutil.copy2(source_path, destination_path)
        t2=dt.datetime.now()
        print(t1,t2,f"文件已成功从 {source_path} 复制到 {destination_path}",f'speed:{round(len/(t2-t1).seconds,2)}MB/s')
    except FileNotFoundError:
        print("错误：源文件不存在")
    except PermissionError:
        print("错误：没有足够的权限")
    except Exception as e:
        print(f"发生未知错误: {e}")

if __name__ == "__main__":
    # source = input("请输入源文件路径：")
    # destination = input("请输入目标路径：")
    src='D:/system/windows_11_professional_x64_2024.iso'
    for i in range(0,25,1):
        dst=f'h:/{i}.iso'
        copy_file(src, dst)
 # type: ignore